package com.chuanjiabao.wisdom.util.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.chuanjiabao.wisdom.R;
import com.chuanjiabao.wisdom.databinding.DialogFirstHintBinding;
import com.chuanjiabao.wisdom.listener.OnPositionClickListener;
import com.flyco.dialog.widget.base.BaseDialog;

public class FirstHintDialog extends BaseDialog {

    private DialogFirstHintBinding binding;
    private OnPositionClickListener listener;

    public FirstHintDialog(Context context) {
        super(context);
        binding = DataBindingUtil.inflate(
                LayoutInflater.from(context),
                R.layout.dialog_first_hint,
                null,
                false
        );
        binding.setDialog(this);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    }

    @Override
    public View onCreateView() {
        widthScale(0.80f);
        return binding.getRoot();
    }

    @Override
    public void setUiBeforShow() {
        setCancelable(false);
        setCanceledOnTouchOutside(false);
    }

    public void setOnBHClickListener(OnPositionClickListener listener) {
        this.listener = listener;
    }

    public void noPoint(View view) {
        dismiss();
        if (listener != null) {
            listener.setOnPositionClickListener(4);
        }
    }

    public void okPoint(View view) {
        dismiss();
        if (listener != null) {
            listener.setOnPositionClickListener(3);
        }
    }

    public void openUser(View view) {
        if (listener != null) {
            listener.setOnPositionClickListener(1);
        }
    }

    public void openDeal(View view) {
        if (listener != null) {
            listener.setOnPositionClickListener(2);
        }
    }

}


